<?php
if (isset($res_standByArticles)) {
	if(mysqli_num_rows($res_standByArticles) >= 1)
	{ ?>
		<form method = "post" action= "moderation.php?page=waitingArticles" class ="pullLeft">
			<span><label for = "sort">Trier Par : </label></span>
			<select name = "sort">
				<option value = "date" <?php if($sortWA == "date"){echo('selected');} ?> >Date</option>
				<option value = "autorID" <?php if($sortWA == "autorID"){echo('selected');} ?> >Auteur</option>
				<option value = "title" <?php if($sortWA == "title"){echo('selected');} ?> >Titre</option>
				<option value = "type" <?php if($sortWA == "type"){echo('selected');} ?> >Catégorie</option>
			</select>
			<select name = "order">
				<option value = "ASC" <?php if($orderWA == "ASC"){echo('selected');} ?> >Croissant</option>
				<option value = "DESC"<?php if($orderWA == "DESC"){echo('selected');} ?> >Décroissant</option>
			</select>
			<button type = "submit" name ="waitArtsSortPost" >Ok</button>
		</form>
<?php	while ($row_sbart = mysqli_fetch_array($res_standByArticles)) 
		{ ?>
			<div class="list-article clearfix <?= colorStatus($row_sbart['statusID']) ?>">
		<?php if(isset($row_sbart['link']) && $row_sbart['imgStatus'] != 3) { ?>
				<img src="<?= imgLink($row_sbart['link']) ?>" alt="image de l'article"/>
		<?php } else { ?>
				<img src="<?= imgLink("img/blockedImg.png") ?>" alt="image de l'article"/>
		<?php }?>
				<div>
					<div class="clearfix">
						<h2 class="pull-left"><a href="<?= WEBROOT ?>article/article.php?id=<?php echo $row_sbart['id']; ?>" ><?php if(isset($row_sbart['title'])) { echo $row_sbart['title']; } ?></a></h2>
					</div>
					<div>
						<a href="<?= WEBROOT ?>user/user.php?id=<?= $row_sbart['autorID'] ?>"><?php if(isset($row_sbart['autor'])) { echo $row_sbart['autor']; } ?></a>
						<span>&emsp;&mdash;&emsp;</span>
						<?php if(isset($row_sbart['date'])) { echo strftime("le %d %B %Y à %H:%M:%S",strtotime($row_sbart['date'])); } ?>
						<span>&emsp;&mdash;&emsp;</span>
						<?php if(isset($row_sbart['type'])) { echo $row_sbart['type']; } ?>
					</div>
					<p><?php if(isset($row_sbart['content'])) { echo substr($row_sbart['content'], 0, 200)."..."; } ?></p>
				</div>
			</div>
	<?php 
		}
	}
	else
	{?>
			<div class="alert alert-warning center-block text-center half-size">
				Il n'y a aucun article en attente
			</div>
<?php
	}
 } ?>